[SERVER]
11.11.11.11

[DOWNLOAD]
relion/3.1.2 $JARVIS_PROXY/3dem/relion/archive/refs/tags/3.1.2.tar.gz relion-3.1.2.tar.gz 

[DEPENDENCY]
module use ./software/modulefiles
module purge
./jarvis -install kgcc/10.3.1 com
module add kgcc/10.3.1
export CC=clang CXX=clang++ FC=flang
./jarvis -install hmpi/1.2.0 gcc
module add hmpi/1.2.0
export CC=mpicc CXX=mpicxx FC=mpif90
./jarvis -install fftw/3.3.10 gcc+mpi
module add fftw/3.3.10
export CC=gcc CXX=g++ FC=gfortran
./jarvis -install wxWidgets/3.0.5 gcc
module add wxWidgets/3.0.5
./jarvis -install ctffind/4.1.14/ gcc

[ENV]
module purge
module use ${JARVIS_ROOT}/software/modulefiles
module add kgcc/10.3.1
module add hmpi/1.2.0
module add fftw/3.3.10 
module add wxWidgets/3.0.5
module add ctffind/4.1.14
export CC=mpicc CXX=mpicxx FC=mpif90
# 源码目录
export SRC_DIR=${JARVIS_ROOT}/workloads/relion/3.1.2/src
# 算例目录
export CASE_DIR=${JARVIS_ROOT}/workloads/relion/3.1.2/case
# 二进制目录
export BIN_DIR=${SRC_DIR}/install/bin/relion_refine_mpi
export MPI_PATH=${HMPI_PATH}
export DEVICE="mlx5_0:1"

[APP]
app_name = relion
build_dir = 
binary_dir = 
case_dir = ${CASE_DIR}

[BUILD]
# 创建源码目录
mkdir -p ${SRC_DIR}
# 创建算例目录
mkdir -p ${CASE_DIR}
# 创建输出目录
mkdir -p ${CASE_DIR}/class3d
cd ${SRC_DIR}

rm -rf relion-3.1.2
tar -xvf ${JARVIS_DOWNLOAD}/relion-3.1.2.tar.gz -C .
cd relion-3.1.2
mkdir build && cd build
sed -i "218i  set(MPI_CXX_INCLUDE_PATH \$ENV{MPI_PATH}/include)" ../CMakeLists.txt
yum install -y libtiff-* fltk* fltk-devel*
yum -y install xorg-x11-xauth
mkdir -p ../install
cmake -DCUDA=OFF  -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=release  -DCMAKE_INSTALL_PREFIX=${SRC_DIR}/install ..
make -j20
make install

[RUN]
run = time -p mpirun --allow-run-as-root -np 32 -bind-to core -x UCX_NET_DEVICES=${DEVICE} -mca pml ucx -mca btl ^vader,tcp,openib,uct -x UCX_TLS=sm ${BIN_DIR}/relion_refine_mpi --j 4 --cpu --pool 100 --dont_combine_weights_via_disc --i Particles/shiny_2sets.star --ref emd_2660.map:mrc --firstiter_cc --ini_high 60 --ctf --ctf_corrected_ref --iter 25 --tau2_fudge 4 --particle_diameter 360 --K 6 --flatten_solvent --zero_mask --oversampling 1 --healpix_order 2 --offset_range 5 --offset_step 2 --sym C1 --norm --scale --random_seed 0 --maxsig 500 --fast_subsets --o ${CASE_DIR}/class3d/test01
binary = 
nodes = 1

[JOB]
#!/bin/sh
#DSUB -n relion
#DSUB --job_type cosched:hmpi
#DSUB -A root.default
#DSUB -q root.default
#DSUB -N 1
#DSUB -R cpu=128
#DSUB -oo relion-%J.out
#DSUB -eo relion-%J.err

##set runtime environment variables

ulimit -s unlimited
ulimit -c unlimited
rm -rf ${CASE_DIR}/class3d/*
echo "----HOSTFILE generated---"
cat $CCS_HOST_FILE
echo "-------------------------"
EXEC_CMD="time -p mpirun --allow-run-as-root -np 32 -bind-to core -x UCX_NET_DEVICES=${DEVICE} -mca pml ucx -mca btl ^vader,tcp,openib,uct -x UCX_TLS=sm,self,rc ${BIN_DIR}/relion_refine_mpi --j 4 --cpu --pool 100 --dont_combine_weights_via_disc --i Particles/shiny_2sets.star --ref emd_2660.map:mrc --firstiter_cc --ini_high 60 --ctf --ctf_corrected_ref --iter 25 --tau2_fudge 4 --particle_diameter 360 --K 6 --flatten_solvent --zero_mask --oversampling 1 --healpix_order 2 --offset_range 5 --offset_step 2 --sym C1 --norm --scale --random_seed 0 --maxsig 500 --fast_subsets --o ${CASE_DIR}/class3d/test01"
echo "$EXEC_CMD"
date
$EXEC_CMD
date
